﻿using System;
using System.IO;
using System.Security;
using System.Text.RegularExpressions;

class RemoveAllListedWords
{
    static void Main()
    {
        try
        {
            using (StreamReader input = new StreamReader("input.txt"))
            {
                using (StreamWriter output = new StreamWriter("output.txt"))
                {
                    string currentLine;
                    string currentLineWords;

                    while ((currentLine = input.ReadLine()) != null)
                    {
                        using (StreamReader words = new StreamReader("words.txt"))
                        {
                            string replace = currentLine;

                            while ((currentLineWords = words.ReadLine()) != null)
                            {
                                replace = Regex.Replace(replace, @"(\b)" + currentLineWords + @"(\b)", "");
                            }
                            output.WriteLine(replace);
                        }
                    }
                }
            }
        }
        catch (FileNotFoundException)
        {
            Console.WriteLine("Cannot find file");
        }
        catch (DirectoryNotFoundException)
        {
            Console.WriteLine("Invalid Folder ");
        }
        catch (PathTooLongException)
        {
            Console.WriteLine("The path is too long");
        }
        catch (UnauthorizedAccessException)
        {
            Console.WriteLine("You don`t have access!");
        }
        catch (NotSupportedException)
        {
            Console.WriteLine("Cannot open this file!");
        }
        catch (SecurityException)
        {
            Console.WriteLine("Not enough permission to open file!");
        }
    }
}